package com.hundsun.yr.universal.p2p.presenter.impl;

import android.content.Context;
import android.text.TextUtils;

import com.hundsun.mobile.zwgt.R;
import com.hundsun.yr.universal.p2p.interactor.base.SegmentInteractor;
import com.hundsun.yr.universal.p2p.ui.activity.base.BaseFragment;
import com.hundsun.yr.universal.p2p.ui.fragment.ApplyingFragment;
import com.hundsun.yr.universal.p2p.ui.fragment.ReturnLoanFragment;
import com.hundsun.yr.universal.p2p.ui.fragment.UnreturnLoanFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by xx on 2017/5/8.
 */
public class MineLoantSegmentInteractorImpl implements SegmentInteractor {
    @Override
    public List<BaseFragment> getFragments(Context context) {
        // TODO Auto-generated method stub
        List<BaseFragment> fragments = new ArrayList<BaseFragment>();
        String[] segments = context.getResources().getStringArray(R.array.mine_loan2_segment);

        for (int i = 0; i < segments.length; i++) {
            /*if (TextUtils.equals(segments[i], context.getString(R.string.mine_invested))) {
                fragments.add(i, new ApplyInFragment());
            } else */if (TextUtils.equals(segments[i], context.getString(R.string.appliy_in))) {
                fragments.add(i, new ApplyingFragment());
            } else if (TextUtils.equals(segments[i], context.getString(R.string.unreturn_loan))) {
                fragments.add(i, new UnreturnLoanFragment());
            } else if (TextUtils.equals(segments[i], context.getString(R.string.return_loan))) {
                fragments.add(i, new ReturnLoanFragment());
            }
        }
        return fragments;
    }
}
